function test01() {
  let p = {
    0: 3,
    1: 6,
    length: 2,
  };
  for (let i = 0; i < p.length; i++) {
    console.log(p[i]);
  }
  let q = [3, 6];
  for (let i = 0; i < q.length; i++) {
    console.log(q[i]);
  }
  //   p 被称为 类数组对象 ，其本质是一个对象，
  //  但拥有length 以及 自然数为key的属性
  //  可以完美配合for i循环

  let r = Array.from(p);
  console.log(r);
}

function test02() {
  let sample = [
    { name: "zhangsan", age: 11 },
    { name: "lisi", age: 13 },
    { name: "wangwu", age: 25 },
  ];
  // form 标签 -> object
  // table 标签 -> array<object>
  //   [1,2,3]       ["zhangsan","lisi"]
  //   array<number>     array<string>
  //   form with table -> object details array<object>
}

function test03() {
  // let ss = "#a22222";
  console.log("begin");
  let ss = "#a2222";
  if (/^#[0-9a-f]{6}$/.test(ss)) {
    console.log("nice");
  } else {
    throw new Error("单据没提交怎么审核？");
  }
  console.log("end");
}

// ==============main=================
// test01();
try {
  test03();
} catch (e) {
  throw e;
}
console.log("xxxx");
